import './Myphoto.scss'
import React, { Component } from 'react';
import { withRouter } from 'react-router-dom'
import { connect } from 'react-redux'

class Myphoto extends Component {
    dian() {
        this.props.history.push('/collect')
    }
    render() {
        return (
            <div className='app'>
                <div className='Myphoto'>
                    <div className='photo'>
                        <img src="https://img2.baidu.com/it/u=3736081359,2828465859&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500" />
                        <span>茹嗨瑞</span>
                    </div>
                </div>
                <div className='Mycollect'>
                    <div className='collect' onClick={() => { this.dian() }}>
                        <span>{this.props.list.length}</span>
                        <p>收藏</p>
                    </div>
                    <div className='integral'>
                        <span>0</span>
                        <p>积分</p>
                    </div>
                    <div className='coupon'>
                        <span>0</span>
                        <p>优惠券</p>
                    </div>
                </div>
            </div>
        );
    }
}

// export default withRouter(Myphoto);

export default connect(
    (state) => { //注入(绑定)store中的数据到 组件的props中
        return {
            list: state.favlist
        }
    },
    (dispatch) => { //注入(绑定)方法 到组件的props中
        return {

        }
    }
)(withRouter(Myphoto))